using System;
using System.Text;
using System.Collections.Generic;
using iBeauty.BusinessObjects;
using iBeauty.DAL;

namespace iBeauty.BLL
{
	public class AccountBLL
	{
		private AccountDAO _AccountDAO;

		public AccountDAO AccountDAO
		{
			get { return _AccountDAO; }
			set { _AccountDAO = value; }
		}

		public AccountBLL()
		{
			AccountDAO = new AccountDAO();
		}
		public List<Account> GetAccounts()
		{
			try
			{
				return AccountDAO.GetAccounts();
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
		public Account GetAccount(string ID)
		{
			try
			{
				return AccountDAO.GetAccount(ID);
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
		public int AddAccount(Account oAccount)
		{
			try
			{
				return AccountDAO.AddAccount(oAccount);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int AddAccount(string ID,DateTime? CreateDate,DateTime? ModifiedDate,DateTime? TimeStamp,string UserName,string Password,string Permit,string Note)
		{
			try
			{
				return AccountDAO.AddAccount(ID,CreateDate,ModifiedDate,TimeStamp,UserName,Password,Permit,Note);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdateAccount(Account oAccount)
		{
			try
			{
				return AccountDAO.UpdateAccount(oAccount);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdateAccount(string ID,DateTime? CreateDate,DateTime? ModifiedDate,DateTime? TimeStamp,string UserName,string Password,string Permit,string Note)
		{
			try
			{
				return AccountDAO.UpdateAccount(ID,CreateDate,ModifiedDate,TimeStamp,UserName,Password,Permit,Note);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveAccount(Account oAccount)
		{
			try
			{
				return AccountDAO.RemoveAccount(oAccount);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveAccount(string ID)
		{
			try
			{
				return AccountDAO.RemoveAccount(ID);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public List<Account> DeserializeAccounts(string Path)
		{
			try
			{
				return GenericXmlSerializer<List<Account>>.Deserialize(Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public void SerializeAccounts(string Path, List<Account> Accounts)
		{
			try
			{
				GenericXmlSerializer<List<Account>>.Serialize(Accounts, Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	}
}
